//
//  OnlineConsultLeft1Cell.m
//  EachBon
//
//  Created by liliang on 14/12/9.
//  Copyright (c) 2014年 HanYouApp. All rights reserved.
//

#import "OnlineConsultLeft1Cell.h"
//#import "UIImageView+WebCache.h"

@implementation OnlineConsultLeft1Cell

- (void)awakeFromNib {
    // Initialization code
    UIImage *bgImage = [UIImage imageNamed:@"left_white"];
    bgImage = [bgImage resizableImageWithCapInsets:UIEdgeInsetsMake(25, 25, 3, 30) resizingMode:UIImageResizingModeStretch];
    self.bubbleBgImageView.image = bgImage;
}

- (void)setData:(NSDictionary *)dataDict
{
    NSString *headIconImageUrlStr = [dataDict objectForKey:@"userPic"];
    NSString *createDateStr       = [dataDict objectForKey:@"addtime"];
    NSString *contentStr          = [dataDict objectForKey:@"content"];
//    NSString *contentStr          = [contentDict objectForKey:@"text"];
//    NSString *contentImageUrlStr  = [contentDict objectForKey:@"pic"];
    
    self.dateLabel.text = createDateStr;
//    [self.headIconImageView sd_setImageWithURL:[NSURL URLWithString:headIconImageUrlStr] placeholderImage:[UIImage imageNamed:@"default_user"]];
    self.headIconImageView.image = [UIImage imageNamed:headIconImageUrlStr];
    self.contentLabel.text = contentStr;
}

- (void)setBounds:(CGRect)bounds
{
    [super setBounds:bounds];
    
    self.contentView.frame = self.bounds;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.contentView updateConstraintsIfNeeded];
    [self.contentView layoutIfNeeded];
    
//    self.contentLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.contentLabel.frame);
    self.contentLabel.preferredMaxLayoutWidth = [UIScreen mainScreen].bounds.size.width-25-48-12-29;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
